package com.xiaomei.manager.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaomei.manager.dao.DiscountAddressMapper;
import com.xiaomei.manager.model.DiscountAddress;
import com.xiaomei.manager.service.IDiscountAddressService;
import com.xiaomei.manager.web.dto.req.AddressQueryDto;
import com.xiaomei.manager.web.page.Page;

@Service
public class DiscountAddressServiceImpl implements IDiscountAddressService {
	@Autowired
	private DiscountAddressMapper discountAddressMapper;
	
	@Override
	public Integer selectMaxID() {
		// TODO Auto-generated method stub
		return discountAddressMapper.selectMaxId();
	}

	@Override
	public List<DiscountAddress> getDiscountAddressList(AddressQueryDto dto,
			Page<DiscountAddress> page) {
		// TODO Auto-generated method stub
		page.setParamDto(dto);
		return discountAddressMapper.selectByParamMap(page);
	}

	@Override
	public boolean createDiscountAddress(DiscountAddress address) {
		// TODO Auto-generated method stub
		return discountAddressMapper.insertSelective(address)==1 ? true : false;
	}

	@Override
	public boolean updateDiscountAddress(DiscountAddress address) {
		// TODO Auto-generated method stub
		return discountAddressMapper.updateByPrimaryKeySelective(address)==1 ? true:false;
	}

	@Override
	public DiscountAddress findOne(Integer id) {
		// TODO Auto-generated method stub
		return discountAddressMapper.selectByPrimaryKey(id);
	}

	@Override
	public DiscountAddress selectDiscountAddressById(Integer id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean deleteDiscountAddress(Integer id) {
		// TODO Auto-generated method stub
		return discountAddressMapper.deleteByPrimaryKey(id)==1 ? true :false;
	}

}
